const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
  .BundleAnalyzerPlugin;

module.exports = {
  publicPath: "./",
  productionSourceMap: false,
  devServer: {
    proxy: {
      "/api": {
        target: "https://192.168.20.124:8001",
        secure: false,
        changeOrigin: true,
        pathRewrite: { "^/api": "" }
      }
    }
  },
  css: {
    loaderOptions: {
      sass: {
        data: `
          @import "./src/assets/css/common.scss";
        `
      },
      less: {
        lessOptions: {
          modifyVars: {
            'text-color': '#333',
            'border-color': '#D8D8D8',
            'background-color': '#0195FF',
            'button-primary-background-color': '#0195FF',
            'button-info-background-color': '#0195FF',
            'button-info-border-color': '#0195FF',
            'button-primary-border-color': '#0195FF',
            'checkbox-checked-icon-color': '#0195FF',
            'radio-checked-icon-color': '#0195FF',
            'checkbox-size': '16px',
            'radio-size': '16px',
            'dialog-confirm-button-text-color': '#0195FF',
            'field-label-width': '92px',
            'uploader-size': '100px',
            'cell-font-size': '16px',
            'cell-line-height': '26px',
          },
        },
      },
    }
  },
  pwa: {
    iconPaths: {
      favicon32: 'favicon.ico',
      favicon16: 'favicon.ico',
      appleTouchIcon: 'favicon.ico',
      maskIcon: 'favicon.ico',
      msTileImage: 'favicon.ico'
    }
  },
  configureWebpack: config => {
    if (process.env.NODE_ENV === "production") {
      return {
        plugins: [new BundleAnalyzerPlugin()]
      };
    }
  },
  chainWebpack: config => { }
};
